/*
* Copyright 2016 Yonyou Auto Information Technology（Shanghai） Co., Ltd. All Rights Reserved.
*
* This software is published under the terms of the YONYOU Software
* License version 1.0, a copy of which has been included with this
* distribution in the LICENSE.txt file.
*
* @Project Name : marketing-common
*
* @File name : ApplicationPropertyReadUtil.java
*
* @Author : sangdeliang
*
* @Date : 2016年12月26日
*
----------------------------------------------------------------------------------
*     Date       Who       Version     Comments
* 1. 2016年12月26日    sangdeliang    1.0
*
*
*
*
----------------------------------------------------------------------------------
*/
	
package org.marketing.common.util;

import java.util.Properties;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

/**
*
* @author sangdeliang
* TODO description
* @date 2016年12月26日
*/
public class ApplicationPropertyReadUtil {

    public static String getApplicationPropertyValue(String key){

        try {
            Resource resource = new ClassPathResource("/application.properties");//
            Properties props = PropertiesLoaderUtils.loadProperties(resource);
            if (props == null || props.getProperty(key) == null) {
                return "";
            }
            return props.getProperty(key);
        } catch (Exception e) {
            return "";
        }
    }


}
